package main

import (
	"flag"
	"fmt"
	"learngo/crawler_distribute/rpcsupport"
	"learngo/crawler_distribute/worker"
	"log"
)

// 建立命令行参数
// flag库
var port = flag.Int("port", 0, "the port for me to listen on")

// go run worker.go --port=9000
func main() {
	flag.Parse()
	if *port == 0 {
		fmt.Println("must specify a port")
		return
	}
	log.Fatal(rpcsupport.ServeRpc(fmt.Sprintf(":%d", *port), // *port == config.WorkerPort0
		worker.CrawService{}))
}
